package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据 菜品 id 查询 对应的套餐id
     * @param dishIds
     * @return
     */
    List<SetmealDish> seletByDishIds(List<Long> dishIds);

    /**
     * 新增套餐菜品
     * @param setmealDishes
     */
    void insert(List<SetmealDish> setmealDishes);

    /**
     * 根据 setmealId 删除关联的菜品
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id =#{setmealId}")
    void deleteById(Long setmealId);

    /**
     * 根据 setmealId 查询套餐关联的菜品
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> seleteBySetmealId(Long setmealId);
}
